package judesart.app.client.gallery;

import java.util.List;

import judesart.app.domain.Gallery;
import judesart.app.domain.Room;
import judesart.app.shared.SearchResult;
import judesart.app.shared.ValidationException;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("gallery")
public interface GalleryController extends RemoteService
{
    /**
     * Utility class for simplifying access to the instance of async service.
     */
    public static class Util
    {
        private static GalleryControllerAsync instance;

        public static GalleryControllerAsync getInstance()
        {
            if (instance == null)
            {
                instance = GWT.create(GalleryController.class);
            }
            return instance;
        }
    }

    Gallery createGallery(Gallery gallery) throws ValidationException;

    Gallery updateGallery(Gallery gallery) throws ValidationException;

    void deleteGallery(Long galleryId);

    SearchResult<Gallery> searchGalleries(int startAt, int maxElements);

    Gallery getGallery(Long id);

    Room addRoomToGallery(Long galleryId, Room room);

    void updateRoom(Room room);

    void deleteRoom(Long galleryId, String roomId);

    Room getRoom(String roomKey);

    void addArtworkToRoom(Long artworkId, String roomKey);

    void deleteArtworkFromRoom(Long artworkId, String roomKey);

    List<Gallery> findAllUserGalleries(Long userId);
}
